package router

import (
	"github.com/gin-gonic/gin"
	"project05_web/src/api"
	"project05_web/src/middlewares"
)

func BindUserRouter(router *gin.RouterGroup) {
	routerGroup := router.Group("/user")
	{
		routerGroup.GET("/list", middlewares.JWTAuth(), middlewares.CheckAdmin(), api.GetUserList)               //admin权限下查询所有用户信息
		routerGroup.GET("/findbyusername", middlewares.JWTAuth(), api.GetUserByUserName)                         //通过用户名检索用户
		routerGroup.POST("/passwordlogin", api.PasswordLogin)                                                    //密码登录
		routerGroup.POST("/updatepassword", middlewares.JWTAuth(), middlewares.CheckAdmin(), api.UpdatePassword) //修改密码
		router.POST("/registerbyemail", api.ValidateEmailCode)
		router.POST("/loginbyemail", api.ValidateEmailCodeToLogin)
	}
}
